﻿<phone:PhoneApplicationPage
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
							xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:wp7cinema_ViewModel="clr-namespace:wp7cinema.ViewModel" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" x:Class="wp7cinema.View.TheaterSearchView"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="768"
                            shell:SystemTray.IsVisible="True">
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
            	<toolkit:SlideTransition Mode="SlideDownFadeIn" />
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeIn" />
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
            	<toolkit:SlideTransition Mode="SlideDownFadeOut" />
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeOut" />
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
	<phone:PhoneApplicationPage.Resources>
		<Style x:Key="MovieItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Border x:Name="LayoutRoot" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Background="#FFBDF596" UseLayoutRounding="True">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
										<Storyboard>
											<ColorAnimation Duration="0" To="#FF9EE4E5" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Unfocused"/>
									<VisualState x:Name="Focused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<ContentControl x:Name="ContentContainer" Content="{Binding Title}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="Stretch" FontSize="24" Foreground="#FF3B2E2E"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="RegionItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{Binding Title}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FontSize="24"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="TheaterItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{Binding Name}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FontSize="32" Margin="20,0,0,10"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<DataTemplate x:Key="DataTemplate1">
			<Grid>
				<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Title}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="DataTemplate2">
			<Grid>
				<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="ListPickerFullModeTemplate">
			<StackPanel Orientation="Horizontal" Margin="16,21,0,20">
				<Rectangle Fill="#FFA8E4F3" Stroke="Black" Height="43" Width="43"/>
				<TextBlock TextWrapping="Wrap" Text="{Binding Title}" FontSize="43" Margin="16,0,0,0"/>
			</StackPanel>
		</DataTemplate>
		<DataTemplate x:Key="TheaterListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="DateListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Value}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="TimeTemplate" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled"/>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border Margin="0,0,10,10" BorderThickness="3">
								<StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">
									<TextBlock TextWrapping="Wrap" Text="{Binding ViewStr}" FontSize="{TemplateBinding FontSize}" d:LayoutOverrides="Height"/>
								</StackPanel>
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ListBoxStyle1" TargetType="ListBox">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBox">
						<StackPanel x:Name="ScrollViewer" Background="{TemplateBinding Background}" >
							<ItemsPresenter d:LayoutOverrides="Width"/>
						</StackPanel>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</phone:PhoneApplicationPage.Resources>
	
	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>


	<phone:PhoneApplicationPage.DataContext>
		<wp7cinema_ViewModel:TheaterSearchViewModel/>
	</phone:PhoneApplicationPage.DataContext>

	<Grid x:Name="LayoutRoot"
	      Background="Transparent">
		<Custom:Interaction.Triggers>
			<Custom:EventTrigger SourceName="listPicker" EventName="SelectionChanged">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetMovie" CommandParameter="{Binding ElementName=listPicker, Mode=OneWay}" Command="{Binding SetMovieCommand}"/>
			</Custom:EventTrigger>
			<Custom:EventTrigger EventName="SelectionChanged" SourceName="listPicker1">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetSubRegion" Command="{Binding SetSubRegionCommand}" CommandParameter="{Binding ElementName=listPicker1, Mode=OneWay}"/>
			</Custom:EventTrigger>
			<Custom:EventTrigger EventName="SelectionChanged" SourceName="listPicker2">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetTheaters" Command="{Binding SetTheatersCommand}" CommandParameter="{Binding ElementName=listPicker2, Mode=OneWay}"/>
			</Custom:EventTrigger>
			<Custom:EventTrigger SourceName="TheaterList" EventName="SelectionChanged">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetTheater" Command="{Binding SetTheaterCommand}" CommandParameter="{Binding ElementName=TheaterList, Mode=OneWay}"/>
			</Custom:EventTrigger>
			<Custom:EventTrigger EventName="SelectionChanged" SourceName="TimeList">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetTicketInfo" Command="{Binding SetTicketInfo}" CommandParameter="{Binding SelectedItem, ElementName=TimeList}"/>
			</Custom:EventTrigger>
			<Custom:EventTrigger EventName="SelectionChanged" SourceName="DateList">
				<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetDate" Command="{Binding SetDateCommand}" CommandParameter="{Binding ElementName=DateList, Mode=OneWay}"/>
			</Custom:EventTrigger>
		</Custom:Interaction.Triggers>
		<Grid.Projection>
			<PlaneProjection/>
		</Grid.Projection>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>

		<StackPanel Margin="0,8,8,8" Orientation="Vertical" d:LayoutOverrides="Height" Grid.RowSpan="2">
			<toolkit:ListPicker x:Name="listPicker" Margin="0" Header="영화정보" ItemsSource="{Binding Movies}" ItemTemplate="{StaticResource DataTemplate1}" FontSize="32"/>
			<StackPanel Orientation="Horizontal">
				<toolkit:ListPicker x:Name="listPicker1" Margin="0,0,5,0" ItemsSource="{Binding Region1}" ItemTemplate="{StaticResource DataTemplate1}" Width="233" d:LayoutOverrides="Height" Header="지역1" ItemCountThreshold="10" FontSize="32"/>
				<toolkit:ListPicker x:Name="listPicker2" Margin="0" ItemsSource="{Binding Region2}" ItemTemplate="{StaticResource DataTemplate1}" Width="233" d:LayoutOverrides="Height" Header="지역2" FullModeItemTemplate="{StaticResource ListPickerFullModeTemplate}" FullModeHeader="지역을선택해주세요" ItemCountThreshold="10" FontSize="32"/>
			</StackPanel>
			<toolkit:ListPicker x:Name="TheaterList" Margin="0" Header="상영극장" ItemsSource="{Binding Theaters}" ItemTemplate="{StaticResource TheaterListTemplate}" ItemCountThreshold="10" FontSize="32"/>
			<toolkit:ListPicker x:Name="DateList" Margin="0" Header="날 짜" ItemsSource="{Binding EnableDates}" ItemTemplate="{StaticResource DateListTemplate}" ItemCountThreshold="10" FontSize="32"/>
			<StackPanel Margin="0,20,0,0" Orientation="Vertical" Background="#FF476078">
				<TextBlock TextWrapping="Wrap" Text="상영시간" FontSize="26.667" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
			</StackPanel>
			<ListBox x:Name="TimeList" Margin="0,10,0,0" IsSynchronizedWithCurrentItem="False" ItemContainerStyle="{StaticResource TimeTemplate}" ItemsSource="{Binding Tickets}" FontSize="32" Style="{StaticResource ListBoxStyle1}"/>
		</StackPanel>
	</Grid>


</phone:PhoneApplicationPage>